package com.meepo.usercenter.feedback

import android.os.Bundle
import android.util.Log
import android.view.View
import com.meepo.sdk.utils.ToastUtils
import com.meepo.basic.components.view.MeepoActivity
import com.meepo.framework.design.helper.StatusBarHelper
import com.meepo.usercenter.API
import com.meepo.usercenter.R
import kotlinx.android.synthetic.main.feedback_activity.back_iv
import kotlinx.android.synthetic.main.feedback_activity.header_rl
import kotlinx.android.synthetic.main.feedback_activity.save_tv
import kotlinx.android.synthetic.main.feedback_activity.sign_et

class FeedbackActivity : MeepoActivity() {


    override fun initView(view: View, savedInstanceState: Bundle?) {
        StatusBarHelper.immerse(this, header_rl)

        back_iv.setOnClickListener { finish() }


        sign_et.showSoftInputOnFocus = true
        sign_et.requestFocus()


        save_tv.setOnClickListener {
            val content = sign_et.text.toString()

            Log.e("FeedbackActivity", sign_et.text.toString())

            if (content != "") {
                presenter.call(
                    API.instance().addFeedback(content),
                    { ToastUtils.showShort("反馈成功"); finish() }
                )
            }
        }
    }


    override fun setUpContentLayout(): Int = R.layout.feedback_activity
    override fun initData() {
    }
}